function(web_server_extract_version)
    FILE(READ "${CMAKE_CURRENT_LIST_DIR}/src/Common/version.hpp" file_contents)
    # 解析 WEB_SERVER_VER_MAJOR
    STRING(REGEX MATCH "WEB_SERVER_VER_MAJOR ([0-9]+)" _ "${file_contents}")
    if(NOT CMAKE_MATCH_COUNT EQUAL 1)
        message(FATAL_ERROR "Could not extract major version number from version.hpp")
    endif()
    set(ver_major ${CMAKE_MATCH_1})
    # 解析 WEB_SERVER_VER_MINOR
    STRING(REGEX MATCH "WEB_SERVER_VER_MINOR ([0-9]+)" _ "${file_contents}")
    if(NOT CMAKE_MATCH_COUNT EQUAL 1)
        message(FATAL_ERROR "Could not extract minor version number from version.hpp")
    endif()
    set(ver_minor ${CMAKE_MATCH_1})
    # 解析 WEB_SERVER_VER_PATCH
    STRING(REGEX MATCH "WEB_SERVER_VER_PATCH ([0-9]+)" _ "${file_contents}")
    if(NOT CMAKE_MATCH_COUNT EQUAL 1)
        message(FATAL_ERROR "Could not extract patch version number from version.hpp")
    endif()
    set(ver_patch ${CMAKE_MATCH_1})
    
    # 设置 PARENR_SCOPE 该变量可以在父目录或者调用新函数的函数上起作用。
    set(WEB_SERVER_VERSION_MAJOR ${ver_major} PARENT_SCOPE) 
    set(WEB_SERVER_VERSION "${ver_major}.${ver_minor}.${ver_patch}" PARENT_SCOPE)
endfunction(web_server_extract_version)
